/* -*- mode: c++ -*- */
/**
 * @file   Tools.ih
 * @author Sebastien Fourey (GREYC)
 * @date   June 2010
 * 
 * @brief  Tools (def. of inline functions and methods)
 * \@copyright
 * This source code is part of the Board project, a C++ library whose
 * purpose is to allow simple drawings in EPS, FIG or SVG files.
 * Copyright (C) 2007 Sebastien Fourey <http://foureys.users.greyc.fr/>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

namespace LibBoard {

namespace Tools {

void secured_strncpy( char * dst, const char * src, size_t count )
{
#if defined( _MSC_VER )
  strncpy_s( dst, count, src, _TRUNCATE );
#else
  strncpy( dst, src, count );
#endif // defined( _MSC_VER )
}

void secured_ctime( char * str, const time_t * t, size_t count )
{
#if defined( _MSC_VER )
  ctime_s( str, count, t );
#else
  strncpy( str, ctime(t), count );
#endif // defined( _MSC_VER )  
}

} // namespace Tools

} // namespace LibBoard
